Skip to content

Conversation

avadootharajesh
Copy link
Contributor

This PR introduces optimizations to both the whitelist and blacklist functions in the string validation module. The key changes are: Efficiency improvements: Updated regex handling for both functions to escape special characters properly and ensure that unnecessary operations are minimized.

Improved error handling: The functions now throw more precise error messages when chars is not provided as a string.

Documentation update: Both functions have been updated with more detailed and accurate JSDoc comments to improve clarity for developers.

The whitelist function has also been added to ensure only characters from the provided chars string are retained, complementing the existing blacklist function which removes characters from the string.

References:
The structure of data to be validated remains consistent with the previous functions; no structural changes to the data input or output are required.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant